package main

import "fmt"

func main()  {
	var arr = []int{1,2,3,4,5,6,7}
	fmt.Println(*shuzutoerchashu(arr))
}

type shuzutreeNode struct {
	val int
	left *shuzutreeNode
	right *shuzutreeNode
}

func shuzutoerchashu(arr []int) *shuzutreeNode {
	if len(arr) <= 0 {
		return nil
	}
	if len(arr) == 1{
		return &shuzutreeNode{val:arr[0]}
	}
	len := len(arr)/2
	node := &shuzutreeNode{val:arr[len]}
	node.left = shuzutoerchashu(arr[:len])
	node.right = shuzutoerchashu(arr[len+1:])
	return node
}